<template>
  <el-dialog
    top="130px"
    width="80%"
    :before-close="oneIndustryHandleClose"
    :close-on-click-modal="false"
    :visible.sync="visible"
  >
    <table v-loading="loading" class="table table-bordered">
      <colgroup>
        <col width="12%" />
        <col width="13%" />
        <col width="12%" />
        <col width="13%" />
        <col width="12%" />
        <col width="13%" />
        <col width="12%" />
        <col width="13%" />
      </colgroup>
      <tbody>
        <tr>
          <td>企业名字</td>
          <td>{{ data.customer_name }}</td>
          <td>主营业务</td>
          <td>
            <span>{{ data.main_budiness }}</span>
          </td>
          <td>企业划型</td>
          <td>
            <span>{{ data.org_class_name }}</span>
          </td>
          <td>销售收入(万元)</td>
          <td>{{ data.sale_income }}</td>
        </tr>
        <tr>
          <td>资产合计(万元)</td>
          <td>
            <span>{{ data.assets_total }}</span>
          </td>

          <td>实际控制人</td>
          <td>
            <span>{{ data.corp_name }}</span>
          </td>
          <td>联系电话</td>
          <td>
            <span>{{ data.corp_phone }}</span>
          </td>
          <td>担保金额(万元)</td>
          <td>
            <span>{{ data.warranty_amount }}</span>
          </td>
        </tr>
        <tr>
          <td>贷款利率(%)</td>
          <td>
            <span>{{ data.load_rate }}</span>
          </td>

          <td>借款用途</td>
          <td>
            <span>{{ data.funds_use_dir }}</span>
          </td>
          <td>保证合同号</td>
          <td>
            <span>{{ data.gua_contract }}</span>
          </td>
          <td>贷款期限</td>
          <td>
            <span>{{ data.warranty_period }}</span>
          </td>
        </tr>
        <tr>
          <td>反担保措施</td>
          <td colspan="3">
            <span>{{ data.warranty_method }}</span>
          </td>

          <td colspan="1">备注</td>
          <td colspan="3">
            <span>{{ data.remark }}</span>
          </td>
        </tr>
        <tr>
          <td>贷款责任发生日期</td>
          <td>
            <span>{{ $utils.dateFormat(data.load_date, 'yyyy-MM-dd') || '-' }}</span>
          </td>
          <td>贷款责任结束日期</td>
          <td>
            <span>{{ $utils.dateFormat(data.load_end_date, 'yyyy-MM-dd') || '-' }}</span>
          </td>
          <td>风险分担比例(%)</td>
          <td>
            <span>{{ data.risk_rate }}</span>
          </td>
          <td>是否为扶贫项目</td>
          <td>
            <span>{{ data.is_poverty_project }}</span>
          </td>
        </tr>
        <tr>
          <td>综合担保利率(%)</td>
          <td>
            <span>{{ data.warranty_rate }}</span>
          </td>
          <td>综合担保费</td>
          <td>
            <span>{{ data.warranty_fee }}</span>
          </td>

          <td>其它成本</td>
          <td>
            <span>{{ data.other_cost }}</span>
          </td>

          <td>负债人</td>
          <td>
            <span>{{ data.res_person }}</span>
          </td>
        </tr>
      </tbody>
    </table>
  </el-dialog>
</template>

<script>
export default {
  components: {},
  props: {
    relatedId: { type: String, default: '' },
    visible: Boolean,
    oneIndustry: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      data: {},
      loading: false,
    }
  },
  computed: {},
  watch: {
    relatedId() {
      this.getData()
    },
    oneIndustry: {
      handler: function (val) {
        this.data = val
      },
      deep: true,
    },
  },
  created() {},
  methods: {
    oneIndustryHandleClose() {
      this.$emit('update:visible', false)
    },
    async getData() {
      this.loading = true
      const {
        $utils: { promise },
        $api: { getData },
      } = this
      const params = { customer_related_id: this.relatedId }
      const [res] = await promise(getData('credit', 'datum_one_county_industry', params))
      this.data = (res && res.data && res.data[0]) || {}
      this.loading = false
    },
  },
}
</script>

<style scoped></style>
